<include file="../../../../../themes/admin_simpleboot3/public@header"/>
<link rel="stylesheet" type="text/css" href="/plugins/modulepara/configdata/css/moduleindex.min.css"/>
<style type="text/css">
	.wrap{ padding-bottom:70px;}
    .pic-list li {
        margin-bottom: 5px;
    }
	.form-actions {
		padding: 15px 15px 15px;
		background-color: #ecf0f1;
		border-top: 1px solid #e5e5e5;
		*zoom:1;
		position:fixed;
		z-index:999;
		bottom:0;
		left:0;
		right:0;
	}
	.form-actions:before, .form-actions:after {
		display: table;
		line-height: 0;
		content: ""
	}
	.form-actions:after {
		clear: both
	}
	.form-actions .form-actions-btn {
		padding-left:15%;	
	}
	.form-actions {
		background-color: #e8edf0;
		border-top: 1px solid #aaa;
		-webkit-border-radius: 3px;
		-moz-border-radius: 3px;
		border-radius: 3px
	}
	.blocktitle{ background:#e8edf0; font-weight:bold; color:red; text-align:center;}
	.blocktitle>td{ border-bottom:1px solid #bbb!important;}
	.leftdata th{ text-align:right}.rightdata>tbody>tr>th{ background:#f7f7f7;}
	.leftdata>tbody>tr>td{ padding-right:10%!important;}
	.leftdata>tbody>tr>td>input.form-control{ width:75%;}
	.leftdata>tbody>tr>td>select.form-control{ width:50%;}.leftdata>tbody>tr>td>textarea.form-control{ width:100%;}
	.form-horizontal .radio, .form-horizontal .checkbox, .form-horizontal .radio-inline, .form-horizontal .checkbox-inline {
		padding-top: 3px
	}
</style>
<if condition="$configinfo['modulename']">
    <php>if(iffile(MODULEPARA_PATH."/configdata/backend/detail_".$configinfo['modulename'].".css") == 1){</php>
        <link href="/plugins/modulepara/configdata/backend/detail_{$configinfo['modulename']}.css" rel="stylesheet">
    <php>}</php>
    <php>if(iffile($configinfo['tplurl']."/configdata/backend/tpl_detail_".$configinfo['modulename'].".css") == 1){</php>
    	<link href="/themes/{$configinfo['tplname']}/model/configdata/backend/tpl_detail_{$configinfo['modulename']}.css" rel="stylesheet">
    <php>}</php>
</if>
<script type="text/html" id="photos-item-tpl">
    <li id="saved-image{id}">
        <input id="photo-{id}" type="hidden" name="photo_urls[]" value="{filepath}">
        <input class="form-control" id="photo-{id}-name" type="text" name="photo_names[]" value="{name}"
               style="width: 200px;" title="图片名称">
        <img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
             onclick="imagePreviewDialog(this.src);">
        <a href="javascript:uploadOneImage('图片上传','#photo-{id}');">替换</a>
        <a href="javascript:(function(){$('#saved-image{id}').remove();})();">移除</a>
    </li>
</script>
<script type="text/html" id="files-item-tpl">
    <li id="saved-file{id}">
        <input id="file-{id}" type="hidden" name="file_urls[]" value="{filepath}">
        <input class="form-control" id="file-{id}-name" type="text" name="file_names[]" value="{name}"
               style="width: 200px;" title="文件名称">
        <a id="file-{id}-preview" href="{preview_url}" target="_blank">下载</a>
        <a href="javascript:uploadOne('文件上传','#file-{id}','file');">替换</a>
        <a href="javascript:(function(){$('#saved-file{id}').remove();})();">移除</a>
    </li>
</script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
</head>
<body>
<div class="wrap js-check-wrap">
	<if condition="empty($_MGPC_GET['listattrid'])"><!--// 【模块参数后台程序模板安装】限制扩展列表关联参数操作其它资讯-->
    <ul class="nav nav-tabs">
        <li><a href="/portal/admin_article/index.html{$configinfo.moreurl}">
        <if condition="iszdyblockconfig() == 1"><!--// 【模块参数后台程序模板安装】是否系统资讯删除权限判断-->配置<else>资讯</if>管理
        </a></li>
        <li class="active"><a href="/portal/admin_article/add.html{$configinfo.moreurl}">
        添加<if condition="iszdyblockconfig() == 1"><!--// 【模块参数后台程序模板安装】是否系统资讯删除权限判断-->配置<else>资讯</if>
        </a></li>
        <li>
            <a href="javascript:history.back(-1);"><i class="fa fa-reply"></i> 返回</a>
        </li>
    </ul>
	<if condition="$otherinfoconfig['langtab'] == 1 || $toptype == '自定义栏目'"><!--// 【模块参数后台程序模板安装】模块参数默认字段开启配置-->
	{$hook_list_listlang}<!--// 【模块参数后台程序模板安装】多语言配置-->
    </if>
	<else>
		<style>form.margin-top-20{ margin-top: 0!important;}</style>
	</if>
    <form action="{:url('AdminArticle/addPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
        <div class="row">
            <div class="col-md-9 leftBlock">
                <table class="table table-bordered leftdata">
					<if condition="iszdyblockconfig($configinfo['moduleid']) == 1 && $configinfo.adminid == 1">
					<tr>
                        <th><span class="form-required">*</span>配置权限</th>
                        <td>
                            <select class="form-control" name="systemok" id="input-systemok">
							  <option value="2">模板配置</option>
							  <option value="1">系统配置</option>
                            </select>
							<div class="help-block">
								<b class="status-text-yellow">模板配置：</b>针对当前网站模板配置的配置功能，供模板开发者选择，不可删除<br />
								<b class="status-text-yellow">系统配置：</b>系统开发者内置配置功能，供系统开发者选择，不可删除<br />
                                <b class="status-text-yellow">制作模板：</b>以上设置用于制作模板时使用，以便下次直接安装使用，可直接导入备份的模板和选择的模板配置资讯安装<br />
                                详情可以参照【simpleboot3】模板下的安装说明，如何将之前备份的模板安装到当前系统
							</div>
                        </td>
                    </tr>
					</if>
                    <tr class="categoryBox">
                        <th width="15%"><span class="form-required">*</span>分类</th>
                        <td>
                            <php>$zdyblockconfig = iszdyblockconfig(0,1);</php>
                        	<php>if($zdyblockconfig['type'] == 1 || $zdyblockconfig['zdytype'] == "config"){</php>
                            <select class="form-control" name="post[category_id]" required id="input-parent" disabled>
                            		<option value="{$configinfo['columnid']}">{$configinfo['columninfo']['name']}</option>
                                </select>
                            <input type="hidden" name="post[category_id]" value="{$configinfo.columnid}" />
                            <php>}else{</php>
                            <select class="form-control" name="post[category_id]" required id="input-parent">
                            		<option value="{$configinfo['moduleid']}">{$configinfo['moduleinfo']['name']}</option>
                                    {$categories_tree}
                                </select>
                            <php>}</php>
                        </td>
                    </tr>
                    <tr class="titleBox">
                        <th><span class="form-required">*</span><if condition="iszdyblockconfig() == 1 && $defaultfield.titlename == '数据标题'"><!--// 【模块参数后台程序模板安装】是否系统资讯删除权限判断-->配置名称<else>{$defaultfield.titlename}</if></th>
                        <td>
                            <input class="form-control" type="text" name="post[post_title]"
                                   id="post_title" required value="{$parameter_default['post_title']}" placeholder="请输入{$defaultfield.titlename}"/>
                        </td>
                    </tr>
                    <if condition="$defaultfield['categoriesok'] == 1"><!--// 【模块参数后台程序模板安装】模块参数默认字段开启配置-->
                    <tr>
                        <th width="100">{$defaultfield.categoriesname}</th>
                        <td>
                            <input class="form-control" type="text" style="width:400px;" value=""
                                   placeholder="请选择{$defaultfield.categoriesname}" onClick="doSelectCategory();" id="js-categories-name-input"
                                   readonly/>
                            <input class="form-control" type="hidden" value="" name="post[categories]"
                                   id="js-categories-id-input"/>
                            <input type="hidden" value="{$configinfo.moduleid}" id="js-modulecategory-input"/>
                        </td>
                    </tr>
                    </if>
                    <if condition="$defaultfield['keywordok'] == 1 || $toptype == '自定义栏目' || $toptype == '自定义单页'"><!--// 【模块参数后台程序模板安装】模块参数默认字段开启配置-->
                    <tr>
                        <th>{$defaultfield.keywordname}</th>
                        <td>
                            <input class="form-control" type="text" name="post[post_keywords]" id="keywords" value="{$parameter_default['post_keywords']}"
                                   placeholder="请输入{$defaultfield.keywordname}">
                            <p class="help-block">多{$defaultfield.keywordname}之间用英文逗号隔开</p>
                        </td>
                    </tr>
                    </if>
                    <if condition="$defaultfield['authorok'] == 1 || $toptype == '自定义栏目'"><!--// 【模块参数后台程序模板安装】模块参数默认字段开启配置-->
                    <tr>
                        <th>{$defaultfield.authorname}</th>
                        <td><input class="form-control" type="text" name="post[post_source]" id="source" value="{$parameter_default['post_source']}"
                                   placeholder="请输入{$defaultfield.authorname}"></td>
                    </tr>
                    </if>
                    <if condition="$defaultfield['descok'] == 1 || $toptype == '自定义栏目' || $toptype == '自定义单页'"><!--// 【模块参数后台程序模板安装】模块参数默认字段开启配置-->
                    <tr>
                        <th>{$defaultfield.descname}</th>
                        <td>
                            <textarea class="form-control" name="post[post_excerpt]" style="height: 80px;"
                                      placeholder="请填写{$defaultfield.descname}">{$parameter_default['post_excerpt']}</textarea>
                        </td>
                    </tr>
                    </if>
                    
                    <!--// 【模块参数后台程序模板安装】其它模块扩展参数HTML钩子函数配置-->
                    <php>$datapara = array('post'=>$parameter_default);
                	hook_article_baseparameter2($datapara);</php>
                    
                    <if condition="$defaultfield['imgsok'] == 1"><!--// 【模块参数后台程序模板安装】模块参数默认字段开启配置-->
                    <tr>
                    	<th>{$defaultfield.imgsname}</th>
                        <td>
                            <ul id="photos" class="pic-list list-unstyled form-inline" style="margin-bottom:0;"></ul>
                            <a href="javascript:uploadMultiImage('图片上传','#photos','photos-item-tpl');"
                               class="btn btn-default btn-sm">选择图片</a>
                        </td>
                    </tr>
                    </if>
                    <if condition="$defaultfield['filesok'] == 1"><!--// 【模块参数后台程序模板安装】模块参数默认字段开启配置-->
                    <tr>
                    	<th>{$defaultfield.filesname}</th>
                        <td>
                            <ul id="files" class="pic-list list-unstyled form-inline" style="margin-bottom:0;">
                            </ul>
                            <a href="javascript:uploadMultiFile('附件上传','#files','files-item-tpl','file');"
                               class="btn btn-sm btn-default">选择文件</a>
                        </td>
                    </tr>
                    </if>
                    <if condition="$defaultfield['audiook'] == 1"><!--// 【模块参数后台程序模板安装】模块参数默认字段开启配置-->
                    <tr>
                    	<th>{$defaultfield.audioname}</th>
                        <td class="form-inline">
                            <input id="file-audio" class="form-control" type="text" name="post[more][audio]"
                                   value="{$post.more.audio|default=''}" placeholder="请上传音频文件" style="width: 200px;">
                            <notempty name="post.more.audio">
                                <a id="file-audio-preview" href="{:cmf_get_file_download_url($post.more.audio)}"
                                   target="_blank">下载</a>
                            </notempty>

                            <a href="javascript:uploadOne('文件上传','#file-audio','audio');">上传</a>
                        </td>
                    </tr>
                    </if>
                    <if condition="$defaultfield['videook'] == 1"><!--// 【模块参数后台程序模板安装】模块参数默认字段开启配置-->
                    <tr>
                    	<th>{$defaultfield.videoname}</th>
                        <td class="form-inline">
                            <input id="file-video" class="form-control" type="text" name="post[more][video]"
                                   value="{$post.more.video|default=''}" placeholder="请上传视频文件" style="width: 200px;">
                            <notempty name="post.more.video">
                                <a id="file-video-preview" href="{:cmf_get_file_download_url($post.more.video)}"
                                   target="_blank">下载</a>
                            </notempty>
                            <a href="javascript:uploadOne('文件上传','#file-video','video');">上传</a>
                        </td>
                    </tr>
                    </if>
                    

{$hook_detail_contenthtml}<!--// 【模块参数后台程序模板安装】模块参数HTML配置-->
{$hook_module_contenthtml}<!--// 【模块参数后台程序模板安装】前台模板配置后台模块参数HTML-->
                    
                    <if condition="$defaultfield['contentok'] == 1 || $toptype == '自定义栏目' || $toptype == '自定义单页'"><!--// 【模块参数后台程序模板安装】模块参数默认字段开启配置-->
                    <tr>
                        <th>{$defaultfield.contentname}</th>
                        <td>
                            <script type="text/plain" id="content" name="post[post_content]" style="height:350px;">{$parameter_default['post_content']}</script>
                        </td>
                    </tr>
                    </if>
                    <if condition="$defaultfield['wapcontentok'] == 1 || $toptype == '自定义栏目' || $toptype == '自定义单页'"><!--// 【模块参数后台程序模板安装】模块参数默认字段开启配置-->
                    <tr>
                        <th>{$defaultfield.wapcontentname}</th>
                        <td>
                        	<p><font style="color:red;">手机站内容为空时默认获取PC站内容【默认可以为空】</font></p>
                            <script type="text/plain" id="contentmobile" name="post[contentmobile]" style="height:350px;">{$parameter_default['contentmobile']}</script>
                            <script>
                            editorcontent = new baidu.editor.ui.Editor();
							editorcontent.render('contentmobile');
							try {
								editorcontent.sync();
							} catch (err) {
							}
                            </script>
                        </td>
                    </tr>
                    </if>
                    <if condition="iszdyblockconfig() == 2 && empty($supplierconfig) && $defaultfield['post_statusok'] != 1 && $toptype != '自定义栏目' && $toptype != '自定义单页'"><!--// 【模块参数后台程序模板安装】是否系统资讯删除权限判断-->
                    <tr class="post_status">
                    	<th>状态</th>
                        <td>
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" id="post-status-checkbox" name="post[post_status]" value="1">{$defaultfield.post_statusname}
                                </label>
                            </div>
                        </td>
                    </tr>
                    </if>
                    {$moduleparameter.morecontenthtml2}<!--// 【模块参数后台程序模板安装】模块参数更多HTML配置-->
                </table>
                <php>
                $hookParam = [
                    'is_add'  => true
                ];
                </php>
                <hook name="portal_admin_article_edit_view_main" param="hookParam"/>
            </div>

			<if condition="$defaultfield['thumbok'] == 1 || $defaultfield['published_timeok'] == 1 || $defaultfield['post_statusok'] == 1 || $defaultfield['templateok'] == 1 || $defaultfield['rightdataok'] == 1 || $toptype == '自定义栏目' || $toptype == '自定义单页'"><!--// 【模块参数后台程序模板安装】模块参数默认字段开启配置-->
            <div class="col-md-3 rightBlock">
                <table class="table table-bordered rightdata">
                	<if condition="$defaultfield['thumbok'] == 1 || $toptype == '自定义栏目' || $toptype == '自定义单页'"><!--// 【模块参数后台程序模板安装】模块参数默认字段开启配置-->
                    <tr>
                        <th><b>{$defaultfield.thumbname}</b></th>
                    </tr>
                    <tr>
                        <td>
                            <div style="text-align: center;">
                                <input type="hidden" name="post[more][thumbnail]" id="thumbnail" value="">
                                <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
                                    <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                         id="thumbnail-preview"
                                         width="135" style="cursor: pointer"/>
                                </a>
                                <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
                            </div>
                        </td>
                    </tr>
                    </if>
                    <if condition="$defaultfield['published_timeok'] == 1 || $toptype == '自定义栏目'"><!--// 【模块参数后台程序模板安装】模块参数默认字段开启配置-->
                    <tr>
                        <th><b>{$defaultfield.published_timename}</b></th>
                    </tr>
                    <tr>
                        <td>
                            <input class="form-control js-bootstrap-datetime" type="text" name="post[published_time]"
                                   value="{:date('Y-m-d H:i:s',time())}">
                        </td>
                    </tr>
                    </if>
                    
                    <if condition="$defaultfield['post_statusok'] == 1 || $toptype == '自定义栏目' || $toptype == '自定义单页'"><!--// 【模块参数后台程序模板安装】模块参数默认字段开启配置-->
                    <tr>
                        <th>状态</th>
                    </tr>  
                    <tr>
                        <td>
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" id="post-status-checkbox" name="post[post_status]" value="1">{$defaultfield.post_statusname}
                                </label>
                            </div>
                        </td>
                    </tr> 
                    </if>  
                    <if condition="$defaultfield['post_statusok'] == 1 || $toptype == '自定义栏目'"><!--// 【模块参数后台程序模板安装】模块参数默认字段开启配置-->               
                    <tr>
                        <td>
                            <div class="checkbox">
                                <label><input type="checkbox" id="is-top-checkbox" name="post[is_top]" value="1">置顶</label>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" id="recommended-checkbox" name="post[recommended]" value="1">推荐
                                </label>
                            </div>
                        </td>
                    </tr>
                    </if>
					
                    <if condition="$defaultfield['templateok'] == 1 || $toptype == '自定义栏目' || $toptype == '自定义单页'"><!--// 【模块参数后台程序模板安装】模块参数默认字段开启配置-->
                    <tr>
                        <th>{$defaultfield.templatename}</th>
                    </tr>
                    <tr>
                        <td>
                            <select class="form-control" name="post[more][template]" id="more-template-select">
                                <option value="">请选择{$defaultfield.templatename}</option>
                                <foreach name="article_theme_files" item="vo">
                                    <php>$value=preg_replace('/^portal\//','',$vo['file']);</php>
                                    <php>
                                        if($configinfo['moduleid'] == $vo['moduleid'] || $vo['moduleid'] == 0){
                                    </php>
                                    <option value="{$value}">{$vo.name} {$vo.file}.html</option>
                                    <php>}</php>
                                </foreach>
                            </select>
                        </td>
                    </tr>
                    </if>
                    
                    <!--// 【模块参数后台程序模板安装】其它模块扩展参数HTML钩子函数配置-->
                    <php>$datapara = array('post'=>$parameter_default);
                	hook_article_baseparameter1($datapara);</php>
					
					{$moduleparameter.morecontenthtml3}<!--// 【模块参数后台程序模板安装】模块参数更多HTML配置-->
                </table>

				<php>
                $hookParam = [
                    'is_add'  => true
                ];
                </php>
                <hook name="portal_admin_article_edit_view_right_sidebar" param="hookParam"/>
            </div>
            <else/>
            <php>
            // 【模块参数后台程序模板安装】反馈模块配置
            if($configinfo['topmodule']['feedbackok'] == 1){
            </php>
            <style>
            .leftBlock{ width:100%;}
            </style>
            <php>}else{</php>
            <style>
			.wrap{ padding-bottom:30px;}
			.blocktitle{ background:none;}
			.blocktitle>td{ border-bottom:none!important;}
			.table-bordered{ border:none;}
            .table-bordered>thead>tr>th, .table-bordered>tbody>tr>th, .table-bordered>tfoot>tr>th, .table-bordered>thead>tr>td, .table-bordered>tbody>tr>td, .table-bordered>tfoot>tr>td{ border:none;}
            .table>thead>tr>th, .table>tbody>tr>th, .table>tfoot>tr>th{ vertical-align:top; padding-top:15px; width:22%;}
			.table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td{ width:78%;}
			.form-horizontal .radio, .form-horizontal .checkbox, .form-horizontal .radio-inline, .form-horizontal .checkbox-inline{ padding-top:5px;}
			.form-horizontal .form-actions{ background:none; position:relative; bottom:0; border-top:none; padding-top:0; padding-bottom:0; margin-bottom:0;}
			.form-horizontal .form-actions .form-actions-btn { padding-left:22.8%;}
            </style>
            <php>}</php>
            </if>
            
        </div>
        <div class="form-group">
            <div class="form-actions">
                <div class="row">
                    <div class="col-md-9 leftBlock">
                        <div class="form-actions-btn">
                            <button type="submit" class="btn btn-primary js-ajax-submit" style="padding:7px 30px;">{:lang('ADD')}</button>
                            <a class="btn btn-default" href="{:url('AdminArticle/index')}" style="padding:7px 30px;">{:lang('BACK')}</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        {$hook_detail_contentexphtml}<!--// 【模块参数后台程序模板安装】模块参数扩展HTML配置-->
    </form>
</div>
<script type="text/javascript" src="/plugins/styleplugins/js/styleplugins.min.js"></script>
<script type="text/javascript" src="/plugins/modulepara/configdata/js/moduleindex.min.js"></script>
<script type="text/javascript" src="__STATIC__/js/vue.min.js"></script>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
    $(function () {
		
		if($("#content").length > 0) {
			editorcontent = new baidu.editor.ui.Editor();
			editorcontent.render('content');
			try {
				editorcontent.sync();
			} catch (err) {
			}
		}

        $('.btn-cancel-thumbnail').click(function () {
            $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#thumbnail').val('');
        });

    });

    function doSelectCategory() {
		var modulecategory = $('#js-modulecategory-input').val();
        var selectedCategoriesId = $('#js-categories-id-input').val();
        openIframeLayer("{:url('AdminCategory/select')}?category="+modulecategory+"&ids=" + selectedCategoriesId, '请选择分类', {
            area: ['700px', '400px'],
            btn: ['确定', '取消'],
            yes: function (index, layero) {
                //do something

                var iframeWin          = window[layero.find('iframe')[0]['name']];
                var selectedCategories = iframeWin.confirm();
                if (selectedCategories.selectedCategoriesId.length == 0) {
                    layer.msg('请选择分类');
                    return;
                }
                $('#js-categories-id-input').val(selectedCategories.selectedCategoriesId.join(','));
                $('#js-categories-name-input').val(selectedCategories.selectedCategoriesName.join(' '));
                //console.log(layer.getFrameIndex(index));
                layer.close(index); //如果设定了yes回调，需进行手工关闭
            }
        });
    }
</script>
<if condition="$configinfo['modulename']">
	<php>if(iffile(MODULEPARA_PATH."/configdata/backend/detail_".$configinfo['modulename'].".js") == 1){</php>
		<script type="text/javascript" src="/plugins/modulepara/configdata/backend/detail_{$configinfo['modulename']}.js"></script>
    <php>}</php>
	<php>if(iffile($configinfo['tplurl']."/configdata/backend/tpl_detail_".$configinfo['modulename'].".js") == 1){</php>
		<script type="text/javascript" src="/themes/{$configinfo['tplname']}/model/configdata/backend/tpl_detail_{$configinfo['modulename']}.js"></script>
    <php>}</php>
</if>
</body>
</html>
